﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace SBPweb.RIA.Client.Common.Collections
{

    public class ManagableReadOnlyObservableCollection<TItem> : ReadOnlyObservableCollection<TItem>
    {

        public ManagableReadOnlyObservableCollection()
            : base(new ObservableCollection<TItem>())
        {
            ManagableItems = Items as ObservableCollection<TItem>;
        }

        public ManagableReadOnlyObservableCollection(IEnumerable<TItem> items)
#if !WINDOWS_PHONE
            : base(new ObservableCollection<TItem>(items))
#else
            : base(new ObservableCollection<TItem>())
#endif
        {
#if WINDOWS_PHONE
            foreach (var item in items)
            {
                Items.Add(item);
            }
#endif
            ManagableItems = Items as ObservableCollection<TItem>;
        }

        public ObservableCollection<TItem> ManagableItems
        {
            get;
            private set;
        }

    }

}